function SST_Ru_PlaceCell_Prop(Placeness_MetaData)
% This function outputs a mobility.xlsx file to use in prism graphing

%% get all basic info to put into a summary table ready
animalNames = {'SST_Ru_845'; 'SST_Ru_847'; 'SST_Ru_F1(2)_30'; 'SST_Ru_F1(2)_33'; 'SST_Ru_F1(2)_35'};
genotype = {'SST_Ru'; 'SST_Ru'; 'SST_Ru'; 'SST_Ru'; 'SST_Ru'};

%% collect saline baseline data
[S845_saline_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_845', 'saline');
[S847_saline_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_847', 'saline');
[S30_saline_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_30', 'saline');
[S33_saline_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_33', 'saline');
[S35_saline_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_35', 'saline');

% concatenate results
saline = cat(1, S845_saline_M, S847_saline_M, S30_saline_M, S33_saline_M, S35_saline_M);

%% collect MPIII3 data
[S845_MPIII3_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_845', 'MP-III 3mg/kg');
[S847_MPIII3_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_847', 'MP-III 3mg/kg');
[S30_MPIII3_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_30', 'MP-III 3mg/kg');
[S33_MPIII3_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_33', 'MP-III 3mg/kg');
[S35_MPIII3_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_35', 'MP-III 3mg/kg');

% concatenate results
MPIII3 = cat(1, S845_MPIII3_M, S847_MPIII3_M, S30_MPIII3_M, S33_MPIII3_M, S35_MPIII3_M);

%% collect L655_07 data
[S845_L655_07_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_845', 'L-655 0.7mg/kg');
[S847_L655_07_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_847', 'L-655 0.7mg/kg');
[S30_L655_07_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_30', 'L-655 0.7mg/kg');
[S33_L655_07_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_33', 'L-655 0.7mg/kg');
[S35_L655_07_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_35', 'L-655 0.7mg/kg');

% concatenate results
L655_07 = cat(1, S845_L655_07_M, S847_L655_07_M, S30_L655_07_M, S33_L655_07_M, S35_L655_07_M);

%% collect Cloz_ON_24h data
[S845_Cloz_ON_24h_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_845', 'Cloz ON (saline, 24h)');
[S847_Cloz_ON_24h_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_847', 'Cloz ON (saline, 24h)');
[S30_Cloz_ON_24h_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_30', 'Cloz ON (saline, 24h)');
[S33_Cloz_ON_24h_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_33', 'Cloz ON (saline, 24h)');
[S35_Cloz_ON_24h_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_35', 'Cloz ON (saline, 24h)');

% concatenate results
Cloz_ON_24h = cat(1, S845_Cloz_ON_24h_M, S847_Cloz_ON_24h_M, S30_Cloz_ON_24h_M, S33_Cloz_ON_24h_M, S35_Cloz_ON_24h_M);

%% collect Cloz_ON_72h data
[S845_Cloz_ON_72h_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_845', 'Cloz ON (saline, 72h)');
[S847_Cloz_ON_72h_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_847', 'Cloz ON (saline, 72h)');
[S30_Cloz_ON_72h_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_30', 'Cloz ON (saline, 72h)');
[S33_Cloz_ON_72h_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_33', 'Cloz ON (saline, 72h)');
[S35_Cloz_ON_72h_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_35', 'Cloz ON (saline, 72h)');

% concatenate results
Cloz_ON_72h = cat(1, S845_Cloz_ON_72h_M, S847_Cloz_ON_72h_M, S30_Cloz_ON_72h_M, S33_Cloz_ON_72h_M, S35_Cloz_ON_72h_M);

%% collect Cloz_ON_1week data
[S845_Cloz_ON_1week_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_845', 'Cloz ON (saline, 1 week)');
[S847_Cloz_ON_1week_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_847', 'Cloz ON (saline, 1 week)');
[S30_Cloz_ON_1week_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_30', 'Cloz ON (saline, 1 week)');
[S33_Cloz_ON_1week_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_33', 'Cloz ON (saline, 1 week)');
[S35_Cloz_ON_1week_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_35', 'Cloz ON (saline, 1 week)');

% concatenate results
Cloz_ON_1week = cat(1, S845_Cloz_ON_1week_M, S847_Cloz_ON_1week_M, S30_Cloz_ON_1week_M, S33_Cloz_ON_1week_M, S35_Cloz_ON_1week_M);

%% collect Cloz_ON_2weeks data
[S845_Cloz_ON_2weeks_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_845', 'Cloz ON (saline, 2 weeks)');
[S847_Cloz_ON_2weeks_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_847', 'Cloz ON (saline, 2 weeks)');
[S30_Cloz_ON_2weeks_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_30', 'Cloz ON (saline, 2 weeks)');
[S33_Cloz_ON_2weeks_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_33', 'Cloz ON (saline, 2 weeks)');
[S35_Cloz_ON_2weeks_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_35', 'Cloz ON (saline, 2 weeks)');

% concatenate results
Cloz_ON_2weeks = cat(1, S845_Cloz_ON_2weeks_M, S847_Cloz_ON_2weeks_M, S30_Cloz_ON_2weeks_M, S33_Cloz_ON_2weeks_M, S35_Cloz_ON_2weeks_M);

%% collect Cloz_ON_3weeks data
[S845_Cloz_ON_3weeks_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_845', 'Cloz ON (saline, 3 weeks)');
[S847_Cloz_ON_3weeks_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_847', 'Cloz ON (saline, 3 weeks)');
[S30_Cloz_ON_3weeks_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_30', 'Cloz ON (saline, 3 weeks)');
[S33_Cloz_ON_3weeks_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_33', 'Cloz ON (saline, 3 weeks)');
[S35_Cloz_ON_3weeks_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_35', 'Cloz ON (saline, 3 weeks)');

% concatenate results
Cloz_ON_3weeks = cat(1, S845_Cloz_ON_3weeks_M, S847_Cloz_ON_3weeks_M, S30_Cloz_ON_3weeks_M, S33_Cloz_ON_3weeks_M, S35_Cloz_ON_3weeks_M);

%% collect Cloz_ON_4weeks data
[S845_Cloz_ON_4weeks_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_845', 'Cloz ON (saline, 4 weeks)');
[S847_Cloz_ON_4weeks_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_847', 'Cloz ON (saline, 4 weeks)');
[S30_Cloz_ON_4weeks_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_30', 'Cloz ON (saline, 4 weeks)');
[S33_Cloz_ON_4weeks_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_33', 'Cloz ON (saline, 4 weeks)');
[S35_Cloz_ON_4weeks_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_35', 'Cloz ON (saline, 4 weeks)');

% concatenate results
Cloz_ON_4weeks = cat(1, S845_Cloz_ON_4weeks_M, S847_Cloz_ON_4weeks_M, S30_Cloz_ON_4weeks_M, S33_Cloz_ON_4weeks_M, S35_Cloz_ON_4weeks_M);

%% collect Cloz_ON_MPIII3 data
[S845_Cloz_ON_MPIII3_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_845', 'Cloz ON (MP-III 3mg/kg)');
[S847_Cloz_ON_MPIII3_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_847', 'Cloz ON (MP-III 3mg/kg)');
[S30_Cloz_ON_MPIII3_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_30', 'Cloz ON (MP-III 3mg/kg)');
[S33_Cloz_ON_MPIII3_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_33', 'Cloz ON (MP-III 3mg/kg)');
[S35_Cloz_ON_MPIII3_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_35', 'Cloz ON (MP-III 3mg/kg)');

% concatenate results
Cloz_ON_MPIII3 = cat(1, S845_Cloz_ON_MPIII3_M, S847_Cloz_ON_MPIII3_M, S30_Cloz_ON_MPIII3_M, S33_Cloz_ON_MPIII3_M, S35_Cloz_ON_MPIII3_M);

%% collect Cloz_ON_L655_07 data
[S845_Cloz_ON_L655_07_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_845', 'Cloz ON (L-655 0.7mg/kg)');
[S847_Cloz_ON_L655_07_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_847', 'Cloz ON (L-655 0.7mg/kg)');
[S30_Cloz_ON_L655_07_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_30', 'Cloz ON (L-655 0.7mg/kg)');
[S33_Cloz_ON_L655_07_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_33', 'Cloz ON (L-655 0.7mg/kg)');
[S35_Cloz_ON_L655_07_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_35', 'Cloz ON (L-655 0.7mg/kg)');

% concatenate results
Cloz_ON_L655_07 = cat(1, S845_Cloz_ON_L655_07_M, S847_Cloz_ON_L655_07_M, S30_Cloz_ON_L655_07_M, S33_Cloz_ON_L655_07_M, S35_Cloz_ON_L655_07_M);

%% collect Cloz_OFF_24h data
[S845_Cloz_OFF_24h_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_845', 'Cloz OFF (saline, 24h)');
[S847_Cloz_OFF_24h_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_847', 'Cloz OFF (saline, 24h)');
[S30_Cloz_OFF_24h_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_30', 'Cloz OFF (saline, 24h)');
[S33_Cloz_OFF_24h_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_33', 'Cloz OFF (saline, 24h)');
[S35_Cloz_OFF_24h_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_35', 'Cloz OFF (saline, 24h)');

% concatenate results
Cloz_OFF_24h = cat(1, S845_Cloz_OFF_24h_M, S847_Cloz_OFF_24h_M, S30_Cloz_OFF_24h_M, S33_Cloz_OFF_24h_M, S35_Cloz_OFF_24h_M);

%% collect Cloz_OFF_1week data
[S845_Cloz_OFF_1week_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_845', 'Cloz OFF (saline, 1 week)');
[S847_Cloz_OFF_1week_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_847', 'Cloz OFF (saline, 1 week)');
[S30_Cloz_OFF_1week_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_30', 'Cloz OFF (saline, 1 week)');
[S33_Cloz_OFF_1week_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_33', 'Cloz OFF (saline, 1 week)');
[S35_Cloz_OFF_1week_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_35', 'Cloz OFF (saline, 1 week)');

% concatenate results
Cloz_OFF_1week = cat(1, S845_Cloz_OFF_1week_M, S847_Cloz_OFF_1week_M, S30_Cloz_OFF_1week_M, S33_Cloz_OFF_1week_M, S35_Cloz_OFF_1week_M);

%% collect Cloz_OFF_2weeks data
[S845_Cloz_OFF_2weeks_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_845', 'Cloz OFF (saline, 2 weeks)');
[S847_Cloz_OFF_2weeks_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_847', 'Cloz OFF (saline, 2 weeks)');
[S30_Cloz_OFF_2weeks_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_30', 'Cloz OFF (saline, 2 weeks)');
[S33_Cloz_OFF_2weeks_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_33', 'Cloz OFF (saline, 2 weeks)');
[S35_Cloz_OFF_2weeks_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_35', 'Cloz OFF (saline, 2 weeks)');

% concatenate results
Cloz_OFF_2weeks = cat(1, S845_Cloz_OFF_2weeks_M, S847_Cloz_OFF_2weeks_M, S30_Cloz_OFF_2weeks_M, S33_Cloz_OFF_2weeks_M, S35_Cloz_OFF_2weeks_M);

%% collect Cloz_OFF_3weeks data
[S845_Cloz_OFF_3weeks_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_845', 'Cloz OFF (saline, 3 weeks)');
[S847_Cloz_OFF_3weeks_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_847', 'Cloz OFF (saline, 3 weeks)');
[S30_Cloz_OFF_3weeks_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_30', 'Cloz OFF (saline, 3 weeks)');
[S33_Cloz_OFF_3weeks_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_33', 'Cloz OFF (saline, 3 weeks)');
[S35_Cloz_OFF_3weeks_M] = PlaceCellProp_Mean_Prism(Placeness_MetaData, 'SST_Ru_F1(2)_35', 'Cloz OFF (saline, 3 weeks)');

% concatenate results
Cloz_OFF_3weeks = cat(1, S845_Cloz_OFF_3weeks_M, S847_Cloz_OFF_3weeks_M, S30_Cloz_OFF_3weeks_M, S33_Cloz_OFF_3weeks_M, S35_Cloz_OFF_3weeks_M);

%% Now, make summary table

PlaceCellProp_Summary_Table = table(animalNames, genotype, saline, MPIII3, L655_07, Cloz_ON_24h, ...
    Cloz_ON_72h, Cloz_ON_1week, Cloz_ON_2weeks, Cloz_ON_3weeks, Cloz_ON_4weeks, Cloz_ON_MPIII3, ...
    Cloz_ON_L655_07, Cloz_OFF_24h, Cloz_OFF_1week, Cloz_OFF_2weeks, Cloz_OFF_3weeks);

%% Export table

[ds, ~] = getdsap;
path = fullfile(ds.metadataPath, 'Prism excel data', 'Place_Cell_Prop.xlsx');

if ~exist((fullfile(ds.metadataPath, 'Prism excel data')), 'dir')
    mkdir(fullfile(ds.metadataPath, 'Prism excel data'));
end
writetable(PlaceCellProp_Summary_Table, path);

end